<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='zh-CN' xml:lang='zh-CN' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<link rel="stylesheet" type="text/css"
	href="${BASE_PATH}/css/easyui.css" />
<link rel="stylesheet" type="text/css" href="${BASE_PATH}/css/icon.css" />
<script type="text/javascript" src="${BASE_PATH}/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript"
	src="${BASE_PATH}/js/jquery.easyui.min.js"></script>
<script type="text/javascript">
	function start(key) {
		$.get("${BASE_PATH}/config/start/" + key, function(result) {
			if (result == "ok") {
				$('#config_table').datagrid("reload");
			}
		});
	}

	function stop(key) {
		$.get("${BASE_PATH}/config/stop/" + key, function(result) {
			if (result == "ok") {
				$('#config_table').datagrid("reload");
			}
		});
	}

	$(function() {

		$('#config_table').datagrid(
				{
					title : '系统配置-站点管理',
					url : '${BASE_PATH}/config/sites',
					width: 900,
					singleSelect : true,
					columns : [ [
							{
								field : 'site',
								title : '站点',
								width : 100
							},
							{
								field : 'url',
								title : 'URL',
								width : 500
							},
							{
								field : 'status',
								title : '状态',
								width : 100
							},
							{
								field : 'total',
								title : '新闻总数',
								width : 100
							},
							{
								field : 'opt',
								title : '操作',
								width : 90,
								formatter : function(value, row, index) {

									if (row.status == "Running") {

										return "<a href=\"javascript:stop('"
												+ row.site + "');\" >停止</a>";
									} else {
										return "<a href=\"javascript:start('"
												+ row.site + "');\" >开始</a>";
									}
								}
							} ] ]
				});

		setInterval(function() {
			$('#config_table').datagrid("reload");
		}, 5000);
	});
</script>
<title>系统配置-站点管理</title>
</head>
<body>
	<table id="config_table"></table>
</body>
</html>